/*************************************************************************
	> File Name: AwinicMec.h
	> Author: 
	> Mail: 
	> Created Time: 2018/1/23 Tue 11:32
	> Version     :
 ************************************************************************/

#ifndef _AWINICMEC_H
#define _AWINICMEC_H

#include "BaseAlgo.h"
#include "MemExcursionLimiter.h"
#include "VoltageLimiter.h"
#include "TemperatureProtect.h"




#define INIT_EXP_BIT (4)                       //InitGain Bit number
#define SCALE_EXP_BIT (ALGOPARAMFACTORBIT)     //ScaleGain Bit number
#define GainData_EXP_BIT (SMOOTH_OUTDATA_BIT)  //GainValue Bit number

#define  DATA_FORMAT_BIT_NUM  (15)     //InData format Data Bit
#define  SHIFT_BUFFER_SIZE    (4800)   //shift number can not over SHIFT_BUFFER_SIZE
#define  TMP_DATA_BUFFER_SIZE (512)    //Temp Data Buffer Size

typedef struct awinicMecCfg{
    uint32_t initGain;
    uint32_t scaleGain;
    uint32_t shiftCnt;
    memExLimiterCfg_t memEx_cfg;
    volLimiterCfg_t  vol_cfg;
    tmpProtectCfg_t tmpProt_cfg;
    int32_t shiftGainBuf[SHIFT_BUFFER_SIZE];
    uint16_t dataBitNum ;
}awinicMecCfg_t;
typedef struct awinicMecParams{
    uint32_t initGain;
    uint32_t scaleGain;
    int32_t xmaxThreshold;
    int32_t vmaxThreshold;
    uint32_t shiftCnt;
    memExLimiterParams_t memEx_params;
    tmpProtParams_t tmpProt_params;
}awinicMecParams_t;

//AwinicAlgo process Get parameter
int awinicAlgoGetParams(awinicMecCfg_t *cfg,awinicMecParams_t *params);
//AwinicAlgo process set parameter
int awinicAlgoSetParams(awinicMecCfg_t *cfg,awinicMecParams_t *params);
//AwinicAlgo process Reset
int awinicAlgoReset(awinicMecCfg_t *cfg);
//AwinicAlgo process initial
int awinicAlgoInit(awinicMecCfg_t *cfg);
//AwinicAlgo  32bit data process
void awinicAlgoProcess32Bit(int32_t *data_ptr,awinicMecCfg_t *cfg,uint16_t dataCnt);
//AwinicAlgo  16bit data process
void awinicAlgoProcess16Bit(int16_t *data_ptr,awinicMecCfg_t *cfg,uint16_t dataCnt);


#endif
